﻿Imports System.Data.OleDb

Public Class hotelinformation
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim conn As OleDbConnection = New OleDbConnection(ConfigurationManager.ConnectionStrings("hotelsConnectionString").ConnectionString)
        Dim sql = "INSERT INTO Comments (Author,Subject,Message,HotelID) VALUES (@f1,@f2,@f3,@f4)"
        Dim cmd = New OleDbCommand(sql, conn)
        conn.Open()
        cmd.Parameters.AddWithValue("@f1", tb_author.Text)
        cmd.Parameters.AddWithValue("@f2", tb_subject.Text)
        cmd.Parameters.AddWithValue("@f3", tb_comment.Text)
        cmd.Parameters.AddWithValue("@f4", Request.Params("ID"))
        cmd.ExecuteNonQuery()
        conn.Close()
        Response.Redirect("hotelinformation.aspx?ID=" & Request.Params("ID"))
    End Sub

    Protected Sub SqlDataSource1_Selecting(sender As Object, e As System.Web.UI.WebControls.SqlDataSourceSelectingEventArgs) Handles SqlDataSource1.Selecting

    End Sub
End Class